package cn.snowheart.rabbitmq.object;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author liuwanxiang
 * @version 2019/05/27
 */
@Slf4j
@Component
public class UserPublisher {

    @Autowired
    private AmqpTemplate amqpTemplate;

    public void publish(User user) {
        log.info("Publish: {}", user);
        this.amqpTemplate.convertAndSend("object", user);
    }

}
